翻訳と辞書
Words near each other
・ Sos and Victoria Petrosyan
・ SOS box
・ SOS Children's Villages
・ SOS Children's Villages UK
・ SOS Children's Villages – USA
・ SOS chromotest
・ Sos del Rey Católico
・ Sos Eltis
・ SOS FC de Gbangouma
・ Sos Hayrapetyan
・ SOS Hermann Gmeiner College
・ Sorsor
・ Sorsum
・ Sorsçay
・ Sort
Sort (C++)
・ SORT (journal)
・ Sort (typesetting)
・ Sort (Unix)
・ Sort code
・ Sort Merge Generator
・ Sort Of
・ Sort of Revolution
・ Sort Sol
・ Sort sol
・ Sort, Lleida
・ Sort-en-Chalosse
・ Sort-merge join
・ Sorta
・ Sorta (band)


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Sort (C++) : ウィキペディア英語版
Sort (C++)

sort is a function in C++ Standard Library that takes two random-access iterators, the start and the end, as arguments and performs a comparison sort on the range of elements between the two iterators, front-inclusive and end-exclusive: '' para. 2〕 This was to allow the use of algorithms like (median-of-3) quicksort, which are fast in the average case, indeed significantly faster than other algorithms like heap sort with optimal worst-case complexity, and where the worst-case quadratic complexity rarely occurs.〔"(Generic Algorithms )", David Musser〕 The introduction of hybrid algorithms such as introsort allowed both fast average performance and optimal worst-case performance, and thus the complexity requirements were tightened in later standards.
Different implementations use different algorithms. The GNU Standard C++ library, for example, uses a 3-part hybrid sorting algorithm: introsort is performed first (introsort itself being a hybrid of quicksort and heap sort), to a maximum depth given by 2×log2 ''n'', where ''n'' is the number of elements, followed by an insertion sort on the result.〔(libstdc++ Documentation: Sorting Algorithm )〕
==Usage==
The sort function is included from the algorithm header of the C++ Standard Library, and carries three arguments: RandomAccessIterator first, RandomAccessIterator last, Compare comp. The third argument has default value - the "less-than" (<) operator to compare elements.
This code sample sorts a given array of integers (in ascending order) and prints it out. Pointers into the array serve as iterators.

#include
#include
int main()

The same functionality using vector container:

#include
#include
#include
int main()


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Sort (C++)」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.